﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win8Demo.Helper;

namespace Win8Demo.NetWork
{
    public class CommonReqEntity
    {
        #region Fields
        protected string _host = "http://test.m.koudai.com/ishopping/";
        #endregion

        #region Properties
        public string Url { get; set; }
        public Dictionary<string,object> Paras { get; set; }
        public Dictionary<string,object> EncryptParas { get; set; }
        public ReqType RequestType { get; set; }
        public EncryptType EncryptType { get; set; }
        #endregion
        /// <summary>
        /// 单纯url请求
        /// </summary>
        /// <param name="url"></param>
        public CommonReqEntity(string url)
        {
            this.Url = url;
        }
        /// <summary>
        /// 非加密请求
        /// </summary>
        /// <param name="url"></param>
        /// <param name="paras"></param>
        /// <param name="requestType"></param>
        public CommonReqEntity(string url, Dictionary<string, object> paras, ReqType requestType)
        {
            this.Url = this._host + url;
            this.Paras = paras;
            this.RequestType = requestType;
            this.EncryptType = EncryptType.NONE;
        }
        /// <summary>
        /// 加密请求
        /// </summary>
        /// <param name="url"></param>
        /// <param name="encryptParas"></param>
        /// <param name="requestType"></param>
        /// <param name="encryptType"></param>
        public CommonReqEntity(string url, Dictionary<string, object> encryptParas, ReqType requestType, EncryptType encryptType)
        {
            this.Url = this._host + url;
            this.EncryptParas = encryptParas;
            this.RequestType = requestType;
            this.EncryptType = encryptType;
        }
    }
}
